<script>
import { getAccessToken } from '@/utils/auth';
export default {
  onLaunch: function () {
    let res = uni.getWindowInfo();
    let app;
    // #ifdef MP-WEIXIN
    app = this.$scope;
    // #endif
    // #ifdef APP-PLUS
    app = getApp();
    // #endif
    // #ifdef H5
    app = getApp();
    // #endif
    app.globalData.fontsize = '28rpx';
    app.globalData.barStyle = `height: ${res.statusBarHeight + 44}px`;
    // 初始化全局的 activePath，默认为 0（首页）
    app.globalData.activePath = 0;
    let token = getAccessToken();
    if (!token) {
      this.$tab.reLaunch('/pages/global/login/login');
    }
  }
};
</script>

<style lang="scss">
@import '@/static/styles/app.scss';
@import '@/static/styles/common.scss';
@import '@/uni_modules/uview-ui/index.scss';
page {
  width: 100vw;
  height: 100vh;
  // 说明：common包含底部边距的所有高度，main是去除底部边距的高度(height需根据端来calc计算)，main里还有content/footer，单独计算高度
  .common {
    width: 100vw;
    height: 100vh;
    box-sizing: border-box;
    background: #fff;
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
    .main {
      width: 100%;
      // #ifndef H5
      height: calc(100% - 98px);
      // #endif
      // #ifdef H5
      height: calc(100% - 44px);
      // #endif
      overflow: hidden;
      position: relative;
      box-sizing: border-box;
    }
  }
}
</style>
